package com.gyz.cfmall.product.web;

import com.gyz.cfmall.product.service.SkuInfoService;
import com.gyz.cfmall.product.vo.SkuItemVo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.concurrent.ExecutionException;

/**
 * @author: gongyuzhuo
 * @since: 2023/4/2 18:43
 * @description:
 */
@Controller
public class ItemController {
    @Resource
    private SkuInfoService skuInfoService;

    @RequestMapping("{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        System.out.println("准备查询" + skuId + "详情");
        SkuItemVo vos = skuInfoService.item(skuId);
        model.addAttribute("item", vos);
        return "item";
    }

//    @RequestMapping("{skuId}.html")
//    public String skuItem(@PathVariable("skuId") Long skuId){
//        System.out.println("准备查询" + skuId + "详情");
//        return "item";
//    }
}
